Global Const AF_DLI = 13 ' /* Direct data link interface */
Global Const AF_LAT = 14 ' /* LAT */
Global Const AF_HYLINK = 15 ' /* NSC Hyperchannel */
Global Const AF_APPLETALK = 16 ' /* AppleTalk */
Global Const AF_NETBIOS = 17 ' /* NetBios-style addresses */
Global Const FD_READ = &H1
Global Const FD_WRITE = &H2
Global Const FD_OOB = &H4
Global Const FD_ACCEPT = &H8
Global Const FD_CONNECT = &H10
Global Const FD_CLOSE = &H20
Global Const INVALID_SOCKET = -1
Global Const SOCKET_ERROR = -1
Declare Function SendSocket Lib "vbsock.vbx" (ByVal s As Integer, ByVal buf As String, ByVal llen As Integer, ByVal flags As Integer) As Integer
Declare Function WSACleanup Lib "winsock" () As Integer
Declare Function CleanSocket Lib "vbsock.vbx" () As Integer
Declare Function OpenSocket Lib "vbsock.vbx" (ByVal PSin_Family As Integer, ByVal PPort As Integer) As Integer
Declare Function InitSocket Lib "vbsock.vbx" () As Integer
Declare Function CloseTheSocket Lib "vbsock.vbx" (ByVal PSocket As Integer) As Integer
Declare Function ConnectSocket Lib "vbsock.vbx" (ByVal PSocket As Integer, ByVal PPort As Integer, ByVal PHost As Long) As Integer
Declare Function OpenSocketWithServer Lib "vbsock.vbx" (ByVal PServerName As String, ByVal PPort As Integer) As Integer
Declare Function SelectSocket Lib "vbsock.vbx" (ByVal PSocket As Integer, ByVal PWnd As Integer, ByVal PWindowMessage As Integer, ByVal PEvent As Long) As Integer
Declare Function listenSocket Lib "vbsock.vbx" (ByVal PSocket As Integer, ByVal BackLog As Integer) As Integer
Declare Function GetSelectEventSocket Lib "vbsock.vbx" (ByVal PParam As Long) As Integer
Declare Function RecvSocket Lib "vbsock.vbx" (ByVal PSocket As Integer, ByVal PBuf As String, ByVal PLen As Integer, ByVal PFlags As Integer) As Integer
Declare Function acceptSocket Lib "vbsock.vbx" (ByVal PSocket As Integer) As Integer
Global Const WSASYSNOTREADY = 10091
Global Const WSAVERNOTSUPPORTED = 10092
Global Const WSAEINVAL = 10022
Global Const WSAEWOULDBLOCK = 10035
Global Const BAD_SOCKET = -1
Global Const UNRESOLVED_HOST = -2
Global Const UNABLE_TO_BIND = -3
Global Const UNABLE_TO_CONNECT = -4
Global Const WIN_SOCKET_MSG = 2000
'--- additional declarations
'Types
Global Const SOCK_STREAM = 1
Global Const SOCK_DGRAM = 2
Global Const SOCK_RAW = 3
Global Const SOCK_RDM = 4
Global Const SOCK_SEQPACKET = 5
'Protocol families, same as address families for now
Global Const PF_UNSPEC = 0
Global Const PF_UNIX = 1
Global Const PF_INET = 2
Global Const PF_IMPLINK = 3
Global Const PF_PUP = 4
Global Const PF_CHAOS = 5
Global Const PF_IPX = 6
Global Const PF_NS = 6
Global Const PF_ISO = 7
Global Const PF_OSI = AF_ISO
Global Const PF_ECMA = 8
Global Const PF_DATAKIT = 9
Global Const PF_CCITT = 10
Global Const PF_SNA = 11
Global Const PF_DECnet = 12
Global Const PF_DLI = 13
Global Const PF_LAT = 14
Global Const PF_HYLINK = 15
Global Const PF_APPLETALK = 16
Global Const PF_NETBIOS = 17
'socket address
Type sockaddr
sa_family As Integer
port As Integer
IP_address(4) As String * 1
sa_data(8) As String * 1
End Type
Declare Function WSAGetLastError Lib "winsock" () As Integer
Declare Function htonl Lib "winsock" (ByVal hostlong As Long) As Long
Declare Function htons Lib "winsock" (ByVal hostshort As Integer) As Integer
Declare Function socket Lib "winsock" (ByVal af As Integer, ByVal type_ As Integer, ByVal protocol As Integer) As Integer
Declare Function connect Lib "winsock" (ByVal PSocket As Integer, PName As sockaddr, ByVal PNameLenght As Integer) As Integer
Declare Function accept Lib "winsock" (ByVal PSocket As Integer, PName As sockaddr, PNameLenght As Integer)